var app = getApp();
var SERVER_URL=app.globalData.SERVER_URL;
Page({
    data: {
        newsList:[]
    },
    onLoad(){
        this.getType();
        this.setData({

        });
    },
    onShow:function(){
        this.setData({

        });
    },

    getType:function(status){
        let url = "/column/getNews";
        let openId = wx.getStorageSync('openId');
        if(status!=0){
            status = status || "";
        }
        url = SERVER_URL+url;
        var _self=this;
        wx.showToast({
            title: '加载中',
            icon: 'loading',
            duration: 500//loading时间
        });
        wx.request({
            url: url,
            data: {
                "key": app.globalData.key,
                openId: openId,
                status: status,
            },
            method: 'GET',
            header: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            success:function(res){
                let result = res.data;
                if(result && result.code==0){
                    _self.setData({
                        newsList:result.data,
                    });
                }
                else{
                    if(result && result.code==1){
                        _self.setData({
                            newsList:[],
                        });
                    }
                }
            }
        });
    },
});